const { v4: uuidv4 } = require("uuid")
const jwt = require("jsonwebtoken")
const config = require("../config")
function getId() {
  return uuidv4()
}

function setToken(data) {
  return jwt.sign(data, config.SECRET, {
    expiresIn: config.tokenExpiresIn
  })
}

// 验证和处理JWT

module.exports = {
  getId,
  setToken
}
